/**
 * Copyright 2018-2020 witer & itdever (https://softcan.cndrealty.com/)
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.ruoyi.common.enums;


/**
 * @author itdever
 * @Description 所有业务异常的枚举
 * @date 2018年11月12日 下午5:04:51
 */
public enum BizExceptionEnum implements AbstractBaseExceptionEnum {

    /**
     * 文件上传
     */
    FILE_READING_ERROR(400, "FILE_READING_ERROR!"),
    FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"),
    UPLOAD_ERROR(500, "上传文件出错"),

    /**
     * 权限和数据问题
     */
    DB_RESOURCE_NULL(400, "数据库中没有该资源"),
    DATA_IS_NULL(400, "数据已不存在"),
    NO_PERMITION(405, "权限异常"),
    REQUEST_INVALIDATE(400, "请求数据格式不正确"),
    INVALID_KAPTCHA(400, "验证码不正确"),
    CANT_DELETE_ADMIN(600, "不能删除超级管理员"),
    CANT_FREEZE_ADMIN(600, "不能冻结超级管理员"),
    CANT_CHANGE_ADMIN(600, "不能修改超级管理员角色"),

    /**
     * 账户问题
     */
    USER_ALREADY_REG(401, "该用户已经注册"),
    NO_THIS_USER(400, "没有此用户"),
    USER_NOT_EXISTED(400, "没有此用户"),
    ACCOUNT_FREEZED(401, "账号被冻结"),
    OLD_PWD_NOT_RIGHT(402, "原密码不正确"),
    TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"),
    NO_ROLE(405, "登录用户未配置角色"),

    /**
     * 错误的请求
     */
    MENU_PCODE_COINCIDENCE(400, "菜单编号和副编号不能一致"),
    EXISTED_THE_MENU(400, "菜单编号重复，不能添加"),
    DICT_MUST_BE_NUMBER(400, "字典的值必须为数字"),
    REQUEST_NULL(400, "请求有错误"),
    REQUEST_PARAMETER_NULL(415, "请求参数为空"),
    REQUEST_PARAMETER_ERROR(416, "请求参数有误"),
    SESSION_TIMEOUT(400, "会话超时"),
    SERVER_ERROR(500, "服务器异常"),
    CHECK_CHILDRENITEM_NAME_REPEAT(500, "检查子项名称复重"),
    CHECK_ITEM_NAME_REPEAT(500, "检查项复重"),
    DATA_ERROR(400, "数据有误"),

    /**
     * token异常
     */
    TOKEN_EXPIRED(1001001, "token过期"),
    TOKEN_ERROR(1001002, "token验证失败"),
    USER_EXPIRED(1001003, "当前用户失效"),
    PROJECT_EXPIRED(1001003, "请重新选择网点"),

    /**
     * 签名异常
     */
    SIGN_ERROR(700, "签名验证失败"),

    /**
     * open api相关异常 19
     */
    CLIENT_ID_NULL(500180001, "请求头X-Client-Id不能为空"),
    TIMESTAMP_NULL(500180002, "请求头X-Timestamp不能为空"),
    TIMESTAMP_ERROR(500180003, "请求头X-Timestamp错误"),
    SIGN_NULL(500180004, "请求头X-Sign不能为空"),
    PROJECT_LABEL_NOT_MATCH(500180005, "项目标识找不到对应项目"),
    API_CONFIG_NOT_EXIST(500180006, "api配置不存在"),

    FUNCTION_NOT_CREATE(50002001, "该方法未实现"),
    PROJECT_IS_NULL(50003001, "网点不存在"),

    ;

    BizExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private Integer code;

    private String message;

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
